//
//  HCBaseNavController.swift
//  新浪微博
//
//  Created by fanhoucheng on 16/9/22.
//  Copyright © 2016年 fanhoucheng. All rights reserved.
//

import UIKit

class HCBaseNavController: UINavigationController {

    override func viewDidLoad() {
        super.viewDidLoad()

        
    }
    
    //重写push方法
    override func pushViewController(_ viewController: UIViewController, animated: Bool) {
        
        let count = childViewControllers.count
        
        if count > 0 {
            
            viewController.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "返回", imageName: "navigationbar_back_withtext", target: self, action: #selector(back))
            viewController.hidesBottomBarWhenPushed = true
        }
        
        super.pushViewController(viewController, animated: animated)
    }
    
    func back() {
        self.popViewController(animated: true)
    }
    
}
